<?php
/**
 * Created by PhpStorm.
 * User: huy
 * Date: 2017/3/8
 * Time: 16:50
 */
//生成一个连接
$conn = mysql_connect('127.0.0.1', 'root', 'aa');
mysql_query("set names utf8");
//选择一个需要操作的数据库
mysql_select_db('djhg', $conn);
//执行MySQL语句
$sql = "select * from djhg_money_log";
$res = mysql_query($sql);
//提取数据

echo "<pre>";
while($row = mysql_fetch_row($res)){
    echo "玩家编号:" . $row[1];
    echo "<br/>";
}
// 释放资源
mysql_free_result($res);
// 关闭连接
mysql_close($conn);

echo "<hr>";
/**
 * mysqli链接
 */
$dbname     = "root";
$dbpass     = "root";
$dbhost     = "127.0.0.1";
$dbdatabase = "mysql";

//生成一个连接
$db_connect = new mysqli($dbhost, $dbname, $dbpass, $dbdatabase);

// 获取查询结果
$strsql = "select * from `go_member_addmoney_record` where `code` = '$code' limit 1";
$result = $db_connect->query($strsql);

// 循环取出记录
while($row = mysqli_fetch_assoc($result)){
    $status   = $row['status'];
    $scookies = $row['scookies'];
}
// 释放资源
$result->close();
// 关闭连接
$db_connect->close();

if($status == "已付款"){
    $success = "success";
}else{
    $success = "faild";
}
echo $success . ";" . $scookies;

